package com.whfc.common.result;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * @Description:
 * @author: xugcheng
 * @version: 1.0
 * @date: 2019-07-23
 */
@Deprecated
public class ResultData<T> implements Serializable {

    /**
     * 单个详细数据对象
     */
    private T detail;

    /**
     * 自定义键值对
     */
    private Map<String, Object> attrs;

    public ResultData() {

    }

    public ResultData(T detail) {
        this.detail = detail;
    }

    public T getDetail() {
        return detail;
    }

    public void setDetail(T detail) {
        this.detail = detail;
    }

    /**
     * 设置自定义属性
     *
     * @param key
     * @param val
     */
    public void attr(String key, Object val) {
        if (this.attrs == null) {
            this.attrs = new HashMap<>(16);
        }
        this.attrs.put(key, val);
    }

    /**
     * 获取自定义属性值
     *
     * @param key
     * @return
     */
    public Object attr(String key) {
        return this.attrs.get(key);
    }
}
